6 Star 6 Fork 2

华为移动服务 / hms-iap-vr-clientdemo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

华为应用内支付服务VR支付客户端示例代码

本文主要介绍华为应用内支付服务(HUAWEI In-App Purchases,IAP)VR支付的客户端开发步骤,帮助您快速了解华为VR支付提供的客户端接口及其使用方法。

目录

简介

华为应用内支付服务为VR设备提供VR支付服务。目前,我们仅提供价格定义接口,商品信息的定义需要您在自己的应用中实现。 免责声明:本demo仅演示商品购买过程,并未实际使用购买的商品。

开发准备

  1. 确认Android Studio开发环境准备就绪,使用Android Studio打开示例代码工程路径下的build.gradle文件。

  2. 在AppGallery Connect中创建应用并配置应用信息。详情请参见配置AppGallery Connect。

  3. 在 Android Studio(3.0及以上版本)导入demo,再进行构建。

  4. 配置示例代码:

    • 在AppGallery Connect中下载应用的agconnect-services.json文件,把该文件添加至本demo的应用根目录(app)中。
    • 添加证书文件,在应用级build.gradle文件中添加配置。
    • 打开AndroidManifest文件,修改package的值为您的应用包名。
    • 将Constant类中的PUBLIC_KEY替换为您应用的公钥。
    • 将Constant类中的PRIVATE_KEY替换为您应用的私钥。
    • Replace the APPID and MERCHANTID in the Constant class with the appid and merchantid of your app.将Constant类中的APPID替换为创建应用的App ID,将Constant类中的MERCHANTID替换为创建应用的CP ID。
  5. 在Android设备或模拟机上运行该示例代码。

环境要求

推荐使用Android SDK 22及以上版本、JDK 1.8及以上版本。

运行结果

运行demo后,会出现如下页面。

点击“确认支付 ¥0.01”,demo会调用pay接口,跳转至付款界面。该界面跳转由华为应用内支付服务支持。

付款成功后,页面将显示支付结果。该页面跳转由华为应用内支付服务支持。

授权许可

华为应用内支付服务VR支付客户端示例代码经过Apache License 2.0授权许可。

# HUAWEI In-App Purchases(IAP) Clientdemo for VR The iap_demo App demonstrates Huawei VR Pay client APIs and usages. ## Table of Content <!-- TOC --> - [Table of Content](#table-of-content) - [Introduction](#introduction) - [Getting Started](#getting-started) - [Supported Environments](#supported-environments) - [Result](#result) - [License](#license) <!-- /TOC --> ## Introduction Huawei VR Pay is a payment service provided by Huawei in-app Purchases in VR devices. Currently, only the api for customizing prices is provided. CP need to define offering information in their apps. Disclaimer: The demo only demonstrates the purchase procedure, and it does not have a real use of purchased products. ## Getting Started 1. Check whether the Android studio development environment is ready. Open the sample code project directory with file "build.gradle" in Android Studio. 2. Finish the configuration in AppGallery Connect. See details: [Configuring AppGallery Connect](https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides-V5/config-agc-0000001050033072-V5) 3. To build this demo, please first import the demo in the Android Studio (3.x+). 4. Configure the sample code: - Download the file "agconnect-services.json" of the app on AGC, and add the file to the app root directory(\app) of the demo. - Add the certificate file to the project and add your configuration to in the app-level `build.gradle` file. - Open the `AndroidManifest` file and change the value of package to your app package name. - Replace the PUBLIC_KEY in the Constant class with the public key of your app. - Replace the PRIVATE_KEY in the Constant class with the private key of your app. - Replace the APPID and MERCHANTID in the Constant class with the appid and merchantid of your app. 5. Run the sample on your Android device or emulator. ## Supported Environments Android SDK Version >= 22 and JDK version >= 1.8 is recommended. ## Result Once you start the demo, you should be able to see the following page. <img src=https://github.com/HMS-Core/hms-iap-vr-clientdemo/blob/master/image/homepage.JPG alt="demo home page" height="600"/> Tap **确认支付 ¥0.01**, the demo will call the `pay` API, and jump to the checkout page which is provided by IAP Service. <img src=https://github.com/HMS-Core/hms-iap-vr-clientdemo/blob/master/image/checkout-page.JPG alt="payment selection" height="600"/> Once purchase succeed, IAP Service will display the purchase result. <img src=https://github.com/HMS-Core/hms-iap-vr-clientdemo/blob/master/image/purchase-result.JPG alt="payment result" height="600"/> ## Question or issues If you want to evaluate more about HMS Core, [r/HMSCore on Reddit](https://www.reddit.com/r/HuaweiDevelopers/) is for you to keep up with latest news about HMS Core, and to exchange insights with other developers. If you have questions about how to use HMS samples, try the following options: - [Stack Overflow](https://stackoverflow.com/questions/tagged/huawei-mobile-services) is the best place for any programming questions. Be sure to tag your question with `huawei-mobile-services`. - [Huawei Developer Forum](https://forums.developer.huawei.com/forumPortal/en/home?fid=0101187876626530001) HMS Core Module is great for general questions, or seeking recommendations and opinions. If you run into a bug in our samples, please submit an [issue](https://github.com/HMS-Core/hms-iap-vr-clientdemo/issues) to the Repository. Even better you can submit a [Pull Request](https://github.com/HMS-Core/hms-iap-vr-clientdemo/pulls) with a fix. ## License This demo is licensed under the [Apache License, version 2.0](http://www.apache.org/licenses/LICENSE-2.0).

简介

华为应用内支付vr支付客户端示例代码。此代码主要介绍华为应用内支付服务VR支付的客户端开发步骤,帮助您快速了解华为VR支付提供的客户端接口及其使用方法。 展开 收起
Java
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/hms-core/hms-iap-vr-clientdemo.git
git@gitee.com:hms-core/hms-iap-vr-clientdemo.git
hms-core
hms-iap-vr-clientdemo
hms-iap-vr-clientdemo
master

搜索帮助